/**
 * 表格数据过滤
 */

const defaultImg = "https://jshoperxms.oss-cn-shanghai.aliyuncs.com/defaultimg/ldnslogo.png"
export default class TableDataTools {



  static filterLdActivityFinish(s) {
    let status = "";
    switch (s) {
      case "1":
        status = "活动已结束";
        break;
      case "2":
        status = "活动进行中";
        break;
      case "0":
        status = "活动未开始";
        break;
      default:
        status = "活动已结束";
    }
    return status;
  }

  static filterLdActivityType(s) {
    let status = "";
    switch (s) {
      case "articlelangdu":
        status = "文章朗读";
        break;
      case "langdumatch":
        status = "诗词比赛";
        break;
      case "customer":
        status = "自定义页面跳转";
        break;
      default:
        status = "自定义页面跳转";
    }
    return status;
  }


  static filterAdvType(s) {
    let status = "";
    switch (s) {
      case "1":
        status = "图片";
        break;
      case "2":
        status = "网页";
        break;
      case "3":
        status = "小程序内跳转";
        break;
      default:
        status = "图片";
    }
    return status;
  }


  static filterStatus(s) {
    let status = "";
    switch (s) {
      case "0":
        status = "禁用";
        break;
      case "2":
        status = "删除";
        break;
      default:
        status = "启用";
    }
    return status;
  }

  static filterArtFileImgs(s) {
    let result = JSON.parse(s);
    if (result.length > 1) {
      return result[0];
    }
    return defaultImg;
  }

  static filterRjArtsContent(s) {
    let result = s;
    if (result.length > 30) {
      return result.substring(0, 30) + "...";
    }
    return result;
  }
}